package com.blen.videolib.util;

import com.blen.lib.ffmpeg.FFmpegUtils;
import com.blen.lib.ffmpeg.FFmpegTask;
//import com.changba.songstudio.util.FFmpegTask;
//import com.changba.songstudio.util.FFmpegUtils;

import icangyu.base.utils.LogUtils;

public class FFUtils {

    public static void runSync(String[] cmd, FFmpegTask.Callback callback){
        new FFmpegTask(callback).execute(cmd);
    }

    public static int run(String cmd){
        return FFmpegUtils.run(cmd);
    }

    public static int run(String[] cmd){
        LogUtils.d("FFCommond",StringUtils.concat(cmd," "));
        return FFmpegUtils.run(cmd);
    }


    public static boolean getThumbnail(String videoPath, String outputPath, String ss){
        String[] str={
                "ffmpeg",
                "-ss",
                ss,
                "-i",
                videoPath,
                "-vframes",
                "1",
                outputPath
        };
        return run(str)==0;
    }

    public static  boolean init(String cachePath,boolean isDebug){
        return  FFmpegUtils.init(cachePath,isDebug);
    }

}
